
/* Collapse Javascript code

	Author: Jonathan Slenders
*/

function init()
{
	var containers = document.getElementsByTagName('div');

	for (var i = 0; i < containers.length; i ++)
		if (containers[i].className == 'collapse_container')
			init_collapse(containers[i]);
}

function init_collapse(container)
{
	var content, less, more;

	for (var i = 0; i < container.childNodes.length; i ++)
	{
		var node = container.childNodes[i];

		if (node.nodeType == document.ELEMENT_NODE)
		{
			if (node.className.match(/\bcollapse_content\b/))
				content = node;

			else if (node.className.match(/\bcollapse_more\b/))
				more = node;

			else if (node.className.match(/\bcollapse_less\b/))
				less = node;
		}
	}

	var click_more = function () {
			content.style.display = 'block';
			less.style.display = 'block';
			more.style.display = 'none';
		};
	var click_less = function () {
			content.style.display = 'none';
			less.style.display = 'none';
			more.style.display = 'block';
		};

	more.addEventListener('click', click_more, false);
	less.addEventListener('click', click_less, false);
	click_less();
}

document.addEventListener("DOMContentLoaded", init, false);
